import axios from 'axios'
const state={
      alluser:[] //这个是装所有用户信息
      
}

const getters={
     
      
}

const  mutations={
  getdatalist(state:any, uuu:any) {  
    //这里uuu是形参位，接收上面返回的context.commit('getdatalist', res.data)
    //  即uuu = res.data
   state.alluser = uuu
 //  console.log(state.shopping);
 
 },
}

const actions={
       async getuser(context:any) {    //async getdata代表getdata是一个异步请求
              //await 不管下面做什么，都要等传回数据之后再做
              await axios({
                method: 'post',
                url: 'http://1.14.73.59:8080/sp/allselect',
                params: {
                  currentPage:1,
                  pageSize:1    
                }
              }).then((res:any) => {
                //  console.log(res);
                //  console.log('-------------------------------------------');
                //  console.log(res.data);
                context.commit('getdatalist', res.data)//这里要返回data
              })
            },
      
}

export default{
       state,
       mutations,
       actions,
       getters
}